home *** CD-ROM | disk | FTP | other *** search
- #include "WoofURL.h"
-
- void ParseWoofURL(char* url, char **hostName, unsigned short *hostNameLen,
- char **procName, unsigned short *procNameLen)
- {
- unsigned short i;
- unsigned short startPos;
-
- *hostName = nil;
- *hostNameLen = 0;
- *procName = nil;
- *procNameLen = 0;
-
- i = 0;
- while ((url[i] != ':') && (url[i] != '\0'))
- ++i;
-
- if ((url[i] == ':') && (url[i+1] == '/') && (url[i+2] == '/'))
- {
- i += 3; // skip over '://'
-
- // find the first string following '//', either hostname or procname
- startPos = i;
- while ((url[i] != '/') && (url[i] != '\0'))
- ++i;
-
- // if stopped at a '/' and more string follows then string is a hostname
- // and the procname follows
- // otherwise the string was a procname and there's no hostname
- if ((url[i] == '/') && (url[i+1] != '\0'))
- {
- *hostName = url + startPos;
- *hostNameLen = i - startPos;
-
- // now find the proc name
- ++i; // skip over '/'
-
- startPos = i;
- while (url[i] != '\0')
- ++i;
- *procName = url + startPos;
- *procNameLen = i - startPos;
- }
- else
- {
- *procName = url + startPos;
- *procNameLen = i - startPos;
- }
- }
- }
-
-